<template>
    <div class="newsinfo">
        <h3 class="title">新闻标题</h3>
        <p class="subtitle">
             <span>
                 发表时间:
                 {{newsinfo.datetime | dateFormat("YYYY-MM-DD")}}
             </span>
             <span>点击:{{newsinfo.click}}次</span>
        </p>
        <hr>
        <div class="imgbox">
            <img :src="newsinfo.url" alt="">
        </div>
        <div class="content" v-html="newsinfo.content">

        </div>
        <app-comments></app-comments>
    </div>
</template>

<script>
import comment from '../subcomponents/commont.vue'
export default {
    data() {
        return {
            id:this.$route.query.sid,
            newsinfo:[]
        }
    },
     methods: {
        getNewslist(){
            this.axios(
                "http://10.31.162.198/1810-3/Vue/vue-cms/src/lib/PHP/newsinfo.php?sid="+this.id,
                {sid:this.id},
            ).then(res=>{
                this.newsinfo=res.data;
                // console.log(this.$route)
            })
        }
    },
    created(){
        this.getNewslist();
    },
    components:{
        "app-comments":comment
    }
}
</script>

<style lang="scss" scoped>
    .newsinfo{
        padding: 0 4px;
        .title{
            font-size: 16px;
            text-align: center;
            margin: 12px 0;
        }
        .subtitle{
            font-size: 13px;
            color: chocolate;
            display: flex;
            justify-content:space-between;
        }
        .imgbox{
            text-align: center;
            img{
                width: 60%;
            }
        }

    }
</style>
